<template>
    <header >
        <div class="l-content">
            <h2 style="color:#fff">图谱管理系统</h2>
        </div>
        <div class="r-content">
            <el-dropdown trigger="click" size="small">
                <span>
                    <img class="user" :src="userImg">
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item @click.native="logout()">退出登录</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </header>
</template>
<script>
export default {
    name:'CommonHeader',
    data(){
        return{
            userImg:require('../assets/images/user.png'),
        }
    },
    methods:{
        logout(){
            window.sessionStorage.clear();
            localStorage.clear();
            // this.$store.commit('clearToken')
            // this.$store.commit('clearMenu')
            this.$router.push({name:'login'})
        },
    }
}
</script>

<style lang='less' scoped>
header{
    padding: 0px 0px;
    background-color: #409EFF;
    display: flex;
    height: 100%;
    justify-content: space-between;
    align-items: center;
}
.l-content{
    margin-left: 20px;
    display: flex;
    align-items: center;
}
.r-content{
    margin-right: 20px;
    .user{
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }
}
</style>
